<template>
	<view class="content">
			<!-- 头部图片展示页面 -->
			<view class="mianImageBox">
				<view class="casual">
					<swiper class="swiper-box" indicator-dots="true" autoplay="true" interval="3000" duration="500" :style="{'height':getSystemInfo.windowWidth+'px'}">
				
						<swiper-item class="swiper" v-for="(item,index) in goodsInfos.imgInfo" :key='index' >  
							<image :src="address+item" class="image" mode="aspectFit"></image>
						</swiper-item>
						
					</swiper>
				</view>
				<!-- 当商品为限时购时 -->
				<view class="whengoods" v-if="goodsDetails.goods_when">
					<text>结束时间{{goodsDetails.goods_when.end_time}}</text>
				</view>
				
				
				<!-- 商品信息栏 -->
				<view class="goodsInfor">
					<view class="goodsdes">
						<view class="goods-name">
							<text class="self" v-if="!shop_id">自营</text>
							<text clas="all-name">{{goodsInfos.title}}</text>
							<text class="details-des">{{goodsInfos.description}}</text>
						</view>
					</view>
					<!-- 价格栏 -->
					<view class="price" v-if="property==0">
						<view>
							<text v-if="!goodsInfos.price_min">0</text>
							<text v-if="goodsInfos.price_min!=goodsInfos.price_max">￥{{goodsInfos.price_min/100}}~{{goodsInfos.price_max/100}}
							</text>
							<text v-else>
								￥{{goodsInfos.price_min/100}} 
							</text>
							<text v-if="!goodsInfos.market_price_min" style="text-decoration: line-through;">0</text>
							
						</view>
						<view>
							<text class="lineThrough" v-if="goodsInfos.market_price_min!=goodsInfos.market_price_max" style="text-decoration: line-through;">零售价￥{{goodsInfos.market_price_min/100}}~{{goodsInfos.market_price_max/100}}</text>
							<text class="lineThrough" v-else style="text-decoration: line-through;">零售价￥{{goodsInfos.market_price_min/100}}</text>
							<!-- <text class="sold">已售 99 件</text> -->
						</view>
					</view>
					
					<view class="price" v-if="property==1">
						<text v-if="!goodsInfos.price_min">0</text>
						<text v-if="goodsInfos.price_min!=goodsInfos.price_max">{{goodsInfos.price_min/100}}积分~{{goodsInfos.price_max/100}}积分 <text v-show="goodsInfos.additional_money_min > 0">+ ￥{{goodsInfos.additional_money_min/100}}</text> </text>
						
					</view>
					<view class="line"></view>
					<view class="selected">
						<view class="selected-view" v-if="selectedSku.length" @click="showContadd">
							
							<view> 
							已选
								<text v-for="(item,index) in selectedSku" :key="index" style="margin-left: 32upx;">
									{{item.name}}
								</text>
								<text style="margin-left: 32upx;">{{number}}件</text>
							</view>
							<image src="../../static/right-arrow.png" mode="" style="width:40upx;height:40upx"></image>
						</view>
						<view class="selected-view" v-else @click="showContadd">
							<text>未选择商品规格</text>
							<image src="../../static/right-arrow.png" mode="" style="width:40upx;height:40upx"></image>
						
						</view>
					</view>
					<!-- <view class="line"></view>
					<view class="sendTo">
						<view >
							<text>配送 至 {{userAddress}}</text>
							<image src="../../static/right-arrow.png" mode="" style="width:40upx;height:40upx"></image>
						</view>
						
					</view> -->
					<view class="line"></view>
					<!-- 评价 -->
					<view class="evaluate" v-if="reviewList.length>0">
						<view class="evaluate-container" >
							<text>宝贝评论（{{reviewList.length}}）</text>
							<view >
								<text @click="SeeMore">查看全部</text>
								<image @click="SeeMore" src="../../static/right-arrow.png" mode="" style="width:40upx;height:40upx;float: none;"></image>
								
							</view>
						</view>
						<view v-for="(item,index) in reviewList" :key='index'>
							<view class="evaluate-list" :class="index==0?'':'evaluate-list-topline'">
									<view class="evaluate-list-headImage">
										
										
										<image v-if="item.logo" :src="address+item.logo" mode="" style="width:60upx;height:60upx;float: none;"></image>
										<image v-else src="../../static/user.png" mode="" style="width:60upx;height:60upx;float: none;"></image>
									</view>
									<view class="evaluate-list-userName">
										<text>{{item.nick}}</text>
										<text class="evaluate-list-date">{{item.time}}</text>
									</view>
								
							</view>
							<view class="evaluate-content">
								<view class="evaluate-contenttext">
									<text>
										{{item.value}}</text>
								</view>
							</view>
						</view>						
					</view>
					
					<view class="deliverInfor"  v-if="rewardMoney > 0">
						<view class="to"  v-if="!goodsWhen && property == 0" @click="goShare(goodsId)"> 
							<text class="first">分享可得</text>
							<text class="to"></text>
							<text  style="padding: 6px 20px; border-radius: 12px;background:#f00; color: #fff;font-weight: bold; font-size: 14px;">
								{{rewardMoney/100}}麦豆
								</text>
							
						</view>
						<view class="to" v-if="goodsWhen && property == 0" @click="goShare(goodsId)">
							<text class="first">分享给朋友</text>
							<text class="to"></text>
						</view>
						<view class="to" v-if="goodsWhen && property == 1" >
								<text class="first" v-if="!goodsInfos.market_price_min" style="text-decoration: line-through;">0</text>
								<text class="first" v-if="goodsInfos.market_price_min!=goodsInfos.market_price_max" style="text-decoration: line-through;">{{goodsInfos.market_price_min/100}}积分~{{goodsInfos.market_price_max/100}}积分</text>
								<text class="first" v-else style="text-decoration: line-through;">{{goodsInfos.market_price_min/100}}积分</text>
						</view>
						<view class="to" v-if="!goodsWhen && property == 1">
							<text class="first" v-if="!goodsInfos.market_price_min" style="text-decoration: line-through;">0</text>
							<text class="first" v-if="goodsInfos.market_price_min!=goodsInfos.market_price_max" style="text-decoration: line-through;">{{goodsInfos.market_price_min/100}}积分~{{goodsInfos.market_price_max/100}}积分</text>
							<text class="first" v-else style="text-decoration: line-through;">{{goodsInfos.market_price_min/100}}元</text>
						</view>
					</view>
					
					<!-- 进入品牌专区 -->
					<view class="brandStore">
						
						<view class="guessGoodsBox">
							<view class="imgDetails" >
								<view class="imgDetails-title">
									<text style="font-size: 28upx; color: #333333;">图文详情</text>
								</view>
								<view class="productsBox" style="margin-bottom: 100px;">
								<!-- 	<text class="infor">产品信息</text> -->
									<view class="messageBox">
										 <rich-text :nodes="details"></rich-text>
									</view>
									<view  v-if="imgNoList"  v-for="(item,index) in imgNoList" class="imgNoLists" :key='index'>
										<image :src="address+item.image_id" :style="{'height':item.autoHeight+'px','width':getSystemInfo.windowWidth+'x'}" mode="aspectFit" class="imgNo_img"></image>
									</view>
								</view>
									<image v-if="goods_image_display" v-for="(i,index) in goods_image"  :key='index' :src="address+ i" style="width: 100%;" ></image>
								
							</view>
						</view>
					</view>
					
				</view>
				<!-- 空白底部，避免购物车遮挡商品信息 -->
				<view style="height:100upx">
				</view>
				<!-- 底部购物车功能 -->
				<view class="shoppingCarBox">
					<view class="shoppingCar" @click="goShare(goodsId)">
						<image src="../../static/share.png" mode=""></image>
						<text class="shoppingCar-text">分享</text>
					</view>
					<view class="collection" @click="collect()">
						<image src="../../static/CollectionNot.png" v-if="!Collection"></image>
						<image src="../../static/Collection.png" v-else></image>
						<text class="collection-text">收藏</text>
					</view>
					
					<text class="add" @click="showContadd" >加入购物车</text>
					<text class="buy" @click="showContgo">立即购买</text>  <!-- v-if="!pay_display" -->
				</view>
				<!-- 购物车遮罩层 -->
				<view class="mask" v-show="xs" @click="showCont">
					
				</view>
				<view class="shoppingx" v-show="xs">
					
					<!-- 底部弹出框 -->
					<view class="shoppingxx">
					
					<view class="close">
						<view class="close-left">
							<view class="">
								<image :src="address+goodsInfos.imgInfo[0]" style="width:100upx;height:100upx;border-radius: 10upx;" mode=""></image>
							</view>
							<view class="close-left-goodname">
								
								<text style="color:#ea3e3e;font-weight: 600;font-size: 32upx; margin-bottom: 10upx;" v-if="property == 0">￥{{money_/100}}</text>   
								<text style="color:#ea3e3e;font-weight: 600;font-size: 32upx; margin-bottom: 10upx;" v-if="property == 1">{{money_/100}}积分</text>   
								
								<!-- <text style="float:right;" v-show="!xs"><uni-icon type="closeempty" size="30"></uni-icon></text> -->
								<view style="color:#666666;font-size: 24upx;">
									<text>库存: {{stock}}</text>
								</view>
							</view>
							
						</view>
						<view class="close-right">
							<uni-icon type="closeempty" size="30" @click="showCont" ></uni-icon>
						</view>
						
					</view>
					  
				  	
					
					
					<view v-for="(item,index) in goods_spu" :key="index" class="skubottom">
						<text class="text-title">{{item.name}}:</text>
						<view class="shoppingx-span">
							<view  class="shopping-for" v-for="(items,indexs) in item.son" :key="indexs">
								<text class="change1" :class="items.class_change" @click="select(items.class_change,items.id,index,indexs)">
								{{items.name}}
								</text>
							</view>
						</view>
					</view>
					
					
					<view class="quantity ">
						<text>购买数量:</text>
						<view class="quantity-right">
							<view @click="lose">
								-
							</view>
							<view class="quantity-right-left-gang">
								{{number}}
							</view>
							<view class="quantity-right-left-gang" @click="add">
								+
							</view>
							<!-- <text @click="lose">-</text>
							<text>{{number}}</text>
							<text @click="add">+</text> -->
						</view>
					</view>
					
					<view class="ascertain" @click="toCar()">
						确定
					</view>
					
				  </view>
				</view>
				
			</view>
			
			
			<view class="mask_content" v-if="pay_display">
				<!-- 支付方式页面 -->
				<view class="pay-methods" >
					<view class="methods-box">
						<view class="title-box">
							<text class="title">请选择支付方式</text>
							<image src="http://rs.eonfox.cc/clzy/static/closeBtn.png" mode="" @click="pay_display=!pay_display"></image>
						</view>
						<view class="pay-time-box">
						<!-- 	<text class="text">请在0小时30分钟内完成支付 金额</text> -->
							<text class="price" v-if="property == 0">￥{{UpdatePrice/100}} 元</text>
							<text class="price" v-if="property == 1">￥{{UpdatePrice/100}} 积分</text>
							
						</view>
						<view class="ali-pay" :class="{active:(payMounted==1)}" @click="payMounted=1">
							<image src="http://rs.eonfox.cc/clzy/static/unknown.png" mode=""></image>
							<text class="ali">钱包支付</text>
							<image v-if="payMounted==1" class="select" src="http://rs.eonfox.cc/clzy/static/choose.png" mode=""></image>
						</view>
						 <!-- #ifdef APP-PLUS -->
						<view class="ali-pay" :class="{active:(payMounted==2)}" @click="payMounted=2">
							<image src="http://rs.eonfox.cc/clzy/static/ali_pay.png" mode=""></image>
							<text class="ali">支付宝</text>
							<image v-if="payMounted==2" class="select" src="http://rs.eonfox.cc/clzy/static/choose.png" mode=""></image>
						</view>
						 <!-- #endif -->
						<view class="weChat-pay"  :class=" {active:(payMounted==3)}" @click="payMounted=3">
							<image src="http://rs.eonfox.cc/clzy/static/wechat.png" mode=""></image>
							<text>微信支付</text>
							<image v-if="payMounted==3" class="select" src="http://rs.eonfox.cc/clzy/static/choose.png" mode=""></image>
						</view>
					</view>
					<view class="submit-btn" @click="submitForm()">
						<text>确认支付</text>
					</view>
				</view>
			</view>
			<view>
				<mpvue-city-picker ref="mpvueCityPicker" 
				 @onCancel="onCancel" @onConfirm="onConfirm"></mpvue-city-picker>
			</view>
		</view>
	
</template>

<script>
	import uniIcon from "@/components/uni-icon/uni-icon.vue";
	import eonfox from '@/components/eonfox/eonfox.js';
	import fns from '@/components/eonfox/fns.js';
	import mpvuePicker from '@/components/mpvue-picker/mpvuePicker.vue';
	import mpvueCityPicker from '@/components/mpvue-citypicker/mpvueCityPicker.vue';
	import cityData from '@/common/city.data.js';
	import pay from '@/components/eonfox/pay.js';
	import city from '../../common/city.data.js';
	var ef = new eonfox();
	export default {
		data() {
			return {
				ticketList:[],
				// goodsInfosall:{},
				id:'',
				inUserId:'',
				inUserPhone:'',
				goodsId:'',
				expressType:[] ,//快递类型
				expressId:[] ,//快递id
				
				discountName:[],//购物券名字
				discountNameMony:[], //购物券名字和金额
				discountId:[],//购物券id
				discount:[], //购物券金额
				discountType:[],//优惠券类型
				index1:0,//购物券的索引值
				
				goodsWhen:{},
				rewardMoney:0,
				property:0,
				imgNoList:[],
				getSystemInfo: {},
				goodsInfos: {
					imgInfo:[	
					],
					title:'',
					description:'',
					price_min:0,
					price_max:0,
					market_price_min:0,
					market_price_max:0
				},
				toFrom:'',
				goods_image:[],
				goods_image_display:false,
				
				class_change:'selecteds',
				Collection:false,
				xs:false,
				number:1,
				address:'',
				goods_spu:[],
				goods_sku:[],
				sku_arr:[],
				sku_id:'',
				imgInfos:[],
				stock:'',
				money_:'',
				repertory:[],
				money:[],
				size:[],
				color:[],
				Discount:[],
				index:0,
				details:'',
				pay_display:false,
				pay_password:false,
				address_id:'',
				order_money:0,
				order_id:'',
				way:'',
				shop_id:'',
				reviewList:[]  ,//评论列表
				due:0  ,//应付款
				minPir:0, //最低价格
				
				
				UpdatePrice:0,  //选择  应付金额的更新	
				hasClick:true,	//判断 是否选择了优惠券
				
				isShow:false,
				user:{
					consignee:'',// [str] [必填] [收货人]
					phone:'',
					province:'',//[str] [必填] [省]
					city:'',//        [str] [必填] [市]
					district:'',//    [str] [必填] [区]
					details:"",//     [str] [必填] [详址]
					default:1,//     [int] [可选] [默认地址。1是0否]
				},
				payMounted:1,//1预付款2支付宝3微信
				checkeds:[],
				userAddress:'请添加收货地址',
				isBackgroundShow: false,
				isAli: false,
				isWeCaht: true,
				isNew: false,
				isPay: false,
				isAll:false,
				is_alls:[],
				user_addressList:[],
				pay_pass_display:false,
				order_method:'money',
				OOrder:[],
				pay_method:'',
				code:'',
				openid:'',
				paymentPasswordDispaly:true,
				payMoneyDispaly:false,
				button_disabled:true,
				TheSelected:'',
				btnCLick: 1, //多次点击
				goodsDetails:[],
				selectedSku:[],   //选中的规格
				selectedNum:0,	  //选择的规格的商品数量
			}
		},
		components: {
			eonfox,
			mpvuePicker,
			mpvueCityPicker,
			uniIcon
		},
		// 加载完成后
		onLoad:function(query){
			console.log('传过来的值',query)
			
			// return
			var that = this
			
			
			
			//获取屏幕高度
			uni.getSystemInfo({
				success: function(res) {
					that.getSystemInfo = res;
					console.log(res.windowWidth);
				}
			});
			that.button_disabled=true;
			that.pay_pass_display = false;
			that.isNew = false;
			that.xs = false;
			that.pay_display = false;
			that.payMoneyDispaly=false;
			that.sku_id="";
			if(query.id){
				that.id=query.id;
				let recommendUid,recommendGoodsId;
				
				try {
				    const value = uni.getStorageSync('recommendInfo');
				    if (value) {
						let cache = JSON.parse(value)
				        console.log(cache,'123');
						recommendUid = cache[0].userid
						recommendGoodsId = cache[0].goodsid
				    }
				} catch (e) {
				   console.log(e)
				}				
				if(recommendGoodsId == query.id){					
					that.inUserId = recommendUid					
				}				
			}
			if(query.user_phone){
				that.inUserPhone = query.user_phone;
			}
			
			ef.submit({
				request: {
					config: ['APPLICATIONCONFIG'],
					goods: ['SHOPGOODSGET',[{id:that.id}]],
					imgInfos: ['SHOPGOODSIMAGE',[{id:that.id, "sort":{"orderby":"sort_asc"}}]],
					collect:['USERCOLLECTIONSELFGET',[{module:'shop_goods',key:that.id}]],
					address:['USERADDRESSSELFGET'],
					imgNo:['SHOPGOODSIMAGE',[{id:that.id, "sort":{"orderby":"sort_asc"}}]],
					review:['USERCOMMENTLIST',[{module:"shop_goods",key:that.id,size:2}]], //that.id  key:'1'
					express:['APPLICATIONSHIPPINGSELFOPTIONS',[{module:'shop_order'}]] ,//快递信息
					discounts: ['USERCOUPONSELFLIST', [{ state: 1 }]],  //优惠卷信息
					
				},
				callback: function(data){
					var dataList=fns.checkError(data,'goods',function(errno,error){
						uni.showToast({
							title:error,
							icon:'none'
						})
					})
					console.log('打印所有参数',data);
					//获取评论列表
					that.reviewList=data.data.review.data.data;
					console.log('that.review',that.reviewList);
					if(dataList.config && dataList.config.qiniu_domain){
						that.address=dataList.config.qiniu_domain;//获取七牛的域名
					}
					if(dataList.address && dataList.address!=''){
							var address=dataList.address
							that.userAddress=address.province+'-'+address.city+'-'+address.district;
								that.toFrom=address.province+address.city+address.district+address.details;
								that.address_id=address.id
								console.log('address',address);
					}
					
					//快递类型
					var arr =[]
					if(dataList.express){
						arr = dataList.express
						console.log("快递",arr)
					}
					
					arr.forEach(item=>{
						that.expressType.push(item.name)
						that.expressId.push(item.id)
					})
					
					
					// // 购物券
					// var arr1 = []
					// if (dataList.discounts && dataList.discounts.data) {
					// 	arr1 = dataList.discounts.data;
					// 	console.log("购物券",arr1)
					// 	// that.ticketList = dataList.discounts.data;
					// 	// console.log('优惠券', that.ticketList);
					// }
					// 
					// arr1.forEach(item=>{
					// 	console.log(item)
					// 	// return
					// 	that.discountName.push(item.name)	
					// 	that.discount.push(item.discount) //价格
					// 	that.discountNameMony.push(item.name + ' ' + '￥'+item.discount/100)
					// 	that.discountId.push(item.id)
					// 	that.discountType.push(item.type) //优惠券类型
					// })
					// 
					// if(dataList){
					// 	that.goodsInfosall=dataList.goods
					// }
					
					if (dataList.goods) {
						var goods=dataList.goods
						// that.allInfo = goods;
					    console.log('goods',goods);
					   that.details=goods.details//商品介绍
					   that.goodsId = goods.id; //商品id
					   that.goodsDetails=goods
					   that.goodsInfos.imgInfo=goods.goods_image;//图片
					   that.goodsInfos.price_min=goods.price_min;//价钱
					   that.goodsInfos.price_max=goods.price_max;//价钱
					   that.goodsInfos.market_price_min = goods.market_price_min; //最低市场价
					   that.minPir = goods.price_min;
					   that.goodsInfos.market_price_max = goods.market_price_max; //最高市场价
					   that.goodsInfos.title=goods.name;//标题
					   that.goodsInfos.details=goods.details;//标题
					   // 商品类型
					   
					   //that.rewardMoney = goods.reward_money;//单品获取奖励
					   that.goodsWhen = goods.goods_when; // 是否是限时商品
					   
					   that.property = goods.property;
					   // console.log(that.goodsInfos.details);
					   that.goodsInfos.description=goods.description;//商品介绍
					   
					   that.shop_id=goods.shop_id//商家id
					   
					   if(goods.goods_sku&&goods.goods_sku[0]&&goods.goods_sku[0].stock){
						   that.stock=goods.goods_sku[0].stock
					   }
					   if(goods.goods_sku&&goods.goods_sku[0]&&goods.goods_sku[0].price){
					   						   that.money_=goods.goods_sku[0].price
					   }
					   var spu=goods.goods_spu;
					   var sku=goods.goods_sku;
					    
					   console.log('spu',spu);
					   if(spu.length>1){
						   for(var i=0; i<spu.length;i++){
						   						   for(var m=0; m<spu[i].son.length;m++){
						   							   for (var k=0; k<sku.length;k++) {
						   									if(sku[k].spu_id.indexOf(spu[i].son[m].id) != -1 ){
						   										spu[i].son[m].class_change='stockTrue';
						   									}
						   							   }
						   						   }
						   // 						   i.class_change='selecteds';
						   // 						   item.push(i)
						   					   }
							console.log('s',goods.goods_sku);
							that.goods_spu=goods.goods_spu;//商品尺寸颜色优惠等信息
							that.goods_sku=goods.goods_sku//商品的库存
					   }
					   else if(spu.length==1){
						   console.log('s',goods.goods_sku);
						   that.goods_spu=goods.goods_spu;//商品尺寸颜色优惠等信息
						   that.goods_sku=goods.goods_sku//商品的库存
						   spu[0].son[0].class_change='selecteds';
						   var skuObj={index:0,name:spu[0].son[0].name}
						   that.selectedSku.push(skuObj)
						   that.button_disabled=false; 
						   that.moneyStock()
					   }
					   // goods.goods_sku.son=item
					  
					  // console.log("spu/sku/in",that.goods_spu,that.goods_sku);
					}
					console.log('imginfo',dataList.imgInfos);
					if(dataList.imgInfos.length){
						that.imgInfos=dataList.imgInfos
					}
					console.log('获取收藏',dataList.collect);
					if(dataList.collect){
						that.Collection=true
					}else{
						that.Collection=false
					}
					if(dataList.imgNo){
						console.log(".......",dataList.imgNo);
						
						//等比例算出高度
						for(var img in dataList.imgNo){
							dataList.imgNo[img].autoHeight = ((that.getSystemInfo.windowWidth/dataList.imgNo[img].width) * dataList.imgNo[img].height).toFixed(0);
						}
						
						that.imgNoList = dataList.imgNo;
						
						
						console.log('1111111111', that.imgNoList);
						
						
					}
                 },
	             error: function(err){
					 fns.err('err',err)
		                 console.log("出错啦", err);
	            },
			});
			that.goods_images_get()
            //缓存在本地的商品id
// 			uni.setStorage({
// 				key: 'footmark',
// 				data:that.id,
// 				complete: function () {
// 					if (footmark){
// 						footmark = []
// 						footmark.push(that.id)
// 					}
// 				}
// 			});
// 			
// 			let footmark = uni.getStorage({
// 				key:'footmark',
// 				 success: function (res) {
//                  console.log(res.data);
//               }
// 			})
// 				console.log("footmark",footmark);
            let footmark = uni.getStorageSync('footmark')

				if (!footmark)
					footmark = []

				if (!footmark.includes(that.id)) {
					footmark.push(that.id)
				}

				uni.setStorageSync('footmark', footmark)
		},
		
		
		
		
		methods: {
			// 购物券
			goquans(){				
				let that = this;
				console.log('******',that.money_)
				ef.submit({
					request:{
						goquans:['USERCOUPONSELFAVAILABLELIST',[{money:that.money_}]] //可用购物券
					},
					callback: function(data){
						var dataList=fns.checkError(data,'goquans',function(errno,error){
							uni.showToast({
								title:error,
								icon:'none'
							})
						})
						// 购物券
						var arr1 = []
						if (dataList.goquans) {
							arr1 = dataList.goquans;
							console.log("购物券",arr1)
							// that.ticketList = dataList.discounts.data;
							// console.log('优惠券', that.ticketList);
						}
						
						arr1.forEach(item=>{
							console.log(item)
							// return
							that.discountName.push(item.name)	
							that.discount.push(item.discount) //价格
							that.discountNameMony.push(item.name + ' ' + '￥'+item.discount/100)
							that.discountId.push(item.id)
							that.discountType.push(item.type) //优惠券类型
						})
						console.log('打印购物券------------',dataList);
					}
				})
			},
			// 多次点击
			btnCLickRest() {
				setTimeout(() => {
					this.btnCLick = 1
				}, 2000)
			},
			//提价订单
			// submitOrder(){
			// 	this.isShow = false;
			// 	this.pay_display=true;
			// 	if(!this.address_id){
			// 		uni.showToast({
			// 			title:'收获地址不能为空',
			// 			icon:'none'
			// 		})
			// 		this.pay_display = false;
			// 		this.isShow = false;
			// 		this.xs=false;
			// 	}
			// },
			goShare(goodsId){
				uni.navigateTo({
					url:'../../pagesB/singleShare/singleShare?goodsId='+goodsId
				})
			},
			pickerType(e){
				console.log('picker发送选择改变，携带值为', e.target.value)
				this.index = e.target.value
			},
			pickerTypeY(e){
				// this.onLoad();
				let that = this;
				this.hasClick = false;  //已选择优惠券
				this.UpdatePrice = this.due;
				console.log('picker发送选择改变，携带值为',e)
				this.index1 = e.target.value
				let discount = this.discount[this.index1] //取出来的价格
				let discountType = this.discountType[this.index1] //类型
				let Duepirce = that.due;

				
				console.log(this.expressId[this.index1])
				// return

				if(discountType==0){
					return
				}else if(discountType==1){ //满减
					if(discount>=Duepirce){
						// console.log('应付0元')
						that.UpdatePrice = 0;
					}else{
						// let paypirce = 
						that.UpdatePrice = Duepirce - discount;
					}
					// return
				}else if(discountType==2){ //代金券
					console.log("代金券")
					// return
				}else if(discountType==3){ //抵扣券
					console.log("抵扣")
					// return
				}else{ //折扣
					console.log("折扣")
					// return
				}
			},
			submitOrder() {
				
				
				var _this=this
				// let flag = _this.btnCLick;
				// if (!flag) {
				// 	return
				// }
				// _this.btnCLick = 0
				// _this.btnCLickRest()
				
					// console.log(this.expressId[this.index])
					// return false;
					
					
				uni.showLoading({
					title:'请稍等。。。',
					icon:'none'
				})	
				if (!this.address_id) {
					uni.showToast({
						title: '收货地址不能为空',
						icon: 'none'
					});
					// _this.btnCLickRest()
					return
				} else {
					// this.isShow = false;
					// this.pay_display = true;
					uni.showToast({
						title:'废物'
					})
					return
					ef.submit({
						request: {
							s: [
								'SHOPCARTSELFADD',
								[
									{
										goods_sku_id: _this.sku_id,
										number: _this.number,
										recommend_user_id:_this.inUserId//推荐人id
									}
								]
							]
						},
						callback(data) {
							var dataList = fns.checkError(data, 's', function(errno, error) {
								uni.showToast({
									title: error,
									icon: 'none'
								});
							});
							_this.xs =false
							_this.isShow = false;
							console.log(dataList,'加入购物车')
							var cart_values=dataList.s
							
							var expressId = _this.expressId[_this.index] 
							console.log('expressIdexpressId',expressId)
							uni.hideLoading()
							uni.navigateTo({
								url:'../../pagesA/submitOrder/submitOrder?cart_values='+cart_values+'&address_id='+_this.address_id+'&expressId='+expressId+'&discountId='+`${_this.hasClick ? '':_this.discountId[_this.index1]}`
							},1500)
							// _this.btnCLickRest()
						}
					});
				
				}
			},
			//判断用户是否登录方法
			jugLogin(){
				var _this = this;
					ef.submit({
					request:{
						jugLogin:['USERSELF']
					},
					callback(data){
						var address=fns.checkError(data,'jugLogin',function(errno,error){
							uni.showToast({
								title:'请先登录',
								icon:'none',
								success() {
									if (ac) {
										clearInterval(setIntervalID);
									}
									var ac = setTimeout(function(){
										uni.reLaunch({
											url:'../../pagesA/register/register'
										});
										return
										// uni.reLaunch({
										// 			url:'../../pagesA/threelogin/threelogin'
										// 		})
									},2000)
								}
							})
						})
					},
					error(err){
						fns.err('err',err,1)
					}
				})
			},
			//添加收货地址
			addAddress(){
				var info=this.user,_this=this;
				if(!info.consignee||!info.phone||!info.province||!info.city||!info.district||!info.details){
					uni.showToast({
						title:'有未填项',
						icon:'none'
					})
					return;
				}	
				ef.submit({
					request:{
						add:['USERADDRESSSELFADD',[info]]
					},
					callback(data){
						var address=fns.checkError(data,'add',function(errno,error){
							uni.showToast({
								title:error,
								icon:'none'
							})
						})
						if(address.add){
							fns.success('添加成功',function(){
								_this.isNew=false;
								_this.isShow=true;
								_this.address_id=address.add
							})
						}
					},
					error(err){
						fns.err('err',err,1)
					}
				})
			},
			// 三级联动选择
			showMulLinkageThreePicker() {
			    this.$refs.mpvueCityPicker.show()
			},
			onConfirm(e) {
				console.log(e);
				var label=e.label;
			    this.userAddress = label;
				var labelArr=label.split('-');
				this.user.province=labelArr[0];
				this.user.city=labelArr[1];
				this.user.district=labelArr[2];
			},
			//添加收货地址
			newAddress() {
				this.isShow = false;
				this.isNew = true
			},
			//立即购买
			immediately(){
				this.pay_display=true;
			},
// 			pay(order_id,money){
// 				console.log('点击支付按钮',order_id,money);
// 				var _this=this
// 				_this.order_money=money,
// 				_this.order_id=order_id
// 				_this.pay_display=true
// 			},
			//提交订单
			submitForm(){
				var _this = this;
				
				
				
				var shopOrderSelfAddConfig = {
					address_id:_this.address_id,
					shop:[{shop_id:_this.shop_id,shop_goods:[{goods_sku_id:_this.sku_id,number:_this.number}]}]
				};
				
				// return
				switch (_this.payMounted){
					case 1:
					_this.pay_method='user_money';
					_this.pay_pass_display = true;
					shopOrderSelfAddConfig.pay_method = 'user_money';
					_this.shopOrderPayment(shopOrderSelfAddConfig, function(response){
						_this.pay_money(response);
					});
						break;
					case 2:
					_this.pay_pass_display=false;
					_this.pay_method='alipay'
					shopOrderSelfAddConfig.pay_method = 'alipay'; //支付方式 weixinpay 微信支付、alipay 支付宝支付
					shopOrderSelfAddConfig.alipay_trade_type = "APP";
					_this.shopOrderPayment(shopOrderSelfAddConfig, function(response){
						_this.pay_alipay(response);
					});
						break;
					case 3:
					_this.pay_pass_display=false;
					_this.pay_method = 'weixinpay';
					shopOrderSelfAddConfig.pay_method = 'weixinpay';
					
					// #ifdef MP-WEIXIN
					shopOrderSelfAddConfig.weixin_trade_type = "JSAPI";
					wx.login({
						//微信小程序登录获取code
						success(res) {
							console.log("wx.login"+JSON.stringify(res));
							if( res.code ){
								_this.code = res.code;
								shopOrderSelfAddConfig.weixin_login_code = res.code;
								_this.shopOrderPayment(shopOrderSelfAddConfig, function(response){
									_this.pay_weixin(response);
								});
							} else {
								_this.isDisable = false;
								console.log('登录失败！' + res.errMsg );
								console.log('登录失败！' + JSON.stringify(res) );
								uni.showToast({
									title: '登录失败！' + res.errMsg,
									icon: 'none',
									//duration: 30000
								});
							}
						}
					});
					// #endif
					// #ifdef APP-PLUS 
					shopOrderSelfAddConfig.weixin_trade_type = "APP";
					_this.shopOrderPayment(shopOrderSelfAddConfig, function(response){
						_this.pay_weixin(response);
					});
					// #endif
					//#ifdef H5
					   _this.payWeChatPMJSAPI()
					//#endif
					break;		
				}
						
						
			},
			//微信公众号支付
			payWeChatPMJSAPI(){
				var _this = this;
				ef.submit({
						request:{
							s:['SESSIONWEIXINACCESSTOKEN']
						},
						callback(data){
							var dataList=fns.checkError(data,'s',function(errno,error){
								uni.showToast({
									title: '请先确认微信授权',
									icon:'none'
								})
							})
							console.log(dataList);
							if(dataList.s){
								ef.submit({
									request: {
										s:[ 'SHOPORDERSELFADD',[{address_id:_this.address_id,
											pay_method: 'weixinpay',
											weixin_trade_type: 'MPJSAPI',
											weixin_login_openid: dataList.s.openid,
										shop:[{shop_id:_this.shop_id,
										shop_goods:[{goods_sku_id:_this.sku_id,number:_this.number}]
										}]  }] ]
									},
									callback(data) {
										console.log('调起微信支付', data);
										var dataList = fns.checkError(data, 's', function(errno, error) {
											uni.showToast({
												title: error,
												icon: 'none'
											});
										});
										var ress = dataList.s;
										if (ress) {
											console.log('ress', ress);
											
											var getBrandWCPayRequest = {
											        appId: ress.appid,
													timeStamp: String(ress.time_stamp), // 支付签名时间戳，注意微信jssdk中的所有使用timestamp字段均为小写。但最新版的支付后台生成签名使用的timeStamp字段名需大写其中的S字符
													nonceStr: ress.nonce_str, // 支付签名随机串，不长于 32 位
													package: 'prepay_id='+ress.prepay_id, // 统一支付接口返回的prepay_id参数值，提交格式如：prepay_id=\*\*\*）
													signType: ress.sign_type, // 签名方式，默认为'SHA1'，使用新版支付需传入'MD5'
													paySign: ress.pay_sign, // 支付签名
											      };
											
											console.log('getBrandWCPayRequest', getBrandWCPayRequest);
											function onBridgeReady(){
											   WeixinJSBridge.invoke(
											      'getBrandWCPayRequest', getBrandWCPayRequest,
											    function(res){
													// uni.showToast({
													// 	title:JSON.stringify(res),
													// 	icon:'none',
													// 	duration:10000
													// })
											      if( res.err_msg == "get_brand_wcpay_request:ok" ){
											     
														
														uni.showToast({
															title:'支付成功',
															success() {
																setTimeout(function(){
																	uni.switchTab({
																	url: '../order/order'
																});
																},2000)
															}
														})
											      } 
												  if(res.err_msg == "get_brand_wcpay_request:fail" ){
													    uni.showToast({
													    	title:'支付失败',
															icon:'none'
													    })
												  }
												  if(res.err_msg == "get_brand_wcpay_request:cancel"){
													  uni.showToast({
													  	title:'已取消支付',
														icon:'none'
													  })
												  }
											   }); 
											}
											
											if (typeof WeixinJSBridge == "undefined"){
											   if( document.addEventListener ){
											       document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
											   }else if (document.attachEvent){
											       document.attachEvent('WeixinJSBridgeReady', onBridgeReady); 
											       document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
											   }
											}else{
											   onBridgeReady();
											}
											
										}else{
											console.log('提交订单失败', ress);
											_this.payWeChatPMJSAPI();
											
										}
										console.log('提交订单', ress);
										
									},
									error(err) {
										console.log('提交订单失败', err, 1);
									}
								});
								
								
							}else{
								
								console.log('location', location.href);
								
								//当 ACCESSTOKEN 不存在
								ef.left_token(function(left_token){
									var notify_url = encodeURIComponent(location.href);
									var url = ef.api_server_url+"?"+encodeURI('data=[["SESSIONWEIXINAUTHORIZE",[{"notify_url":"'+notify_url+'"}]]]')+"&token="+left_token;
									console.log(url);
									location.href = url;
								});
								
							}
						},
						error(err){
							fns.err('err',err,1)
						}
					})
			},
			//付款
			shopOrderPayment( shopOrderSelfAddConfig, callbackFunction ){
				var _this = this;
				//如果不是函数，则默认空函数
				if(typeof callbackFunction !='function'){
					callbackFunction = function(){};
				}
				
				ef.submit({
					request: {
						s: ['SHOPORDERSELFADD', [shopOrderSelfAddConfig]]
					},
					callback(data){
						console.log('调起支付',data)
						var shopOrderSelfAddData = fns.checkError(data,'s',function(errno,error){
							uni.showToast({
								title:error,
								icon:'none',
								duration: 3000
							});
						});
						if( !shopOrderSelfAddData ){
							return false;
						}
						_this.order_id = shopOrderSelfAddData.s.order_id;
						console.log('提交订单', shopOrderSelfAddData);
						return callbackFunction(shopOrderSelfAddData.s);
						
					},
					error(err){
						fns.err('提交订单失败', err, 1);
					}
				});
				
			},
			
			//调起支付（微信）
			pay_weixin(wxArr) {
				var _this = this;
				_this.test='开始了'
				console.log('支付参数'+JSON.stringify(wxArr));
				console.log('调起支付');
				_this.test='调起支付'
				
				// #ifdef APP-PLUS
				var orderInfo = {
					appid:wxArr.appid,
					partnerid:wxArr.mch_id,//商户号
					prepayid:wxArr.prepay_id,//预支付交易会话ID
					package:'Sign=WXPay',//扩展字段,暂填写固定值Sign=WXPay
					noncestr:wxArr.nonce_str,//随机字符串
					timestamp:wxArr.time_stamp,//时间戳	
					sign:wxArr.pay_sign,//签名
				};
				// #endif
				
				uni.requestPayment({
					// #ifdef MP-WEIXIN
					provider: 'wxpay',
					timeStamp: String(wxArr.time_stamp),
					nonceStr: wxArr.nonce_str,
					package: 'prepay_id=' + wxArr.prepay_id,
					signType: wxArr.sign_type,
					paySign: wxArr.pay_sign,
					orderInfo:wxArr,
					// #endif
					// #ifdef APP-PLUS
					provider:'wxpay',
					orderInfo: JSON.stringify(orderInfo),
					// #endif
					success: function(res) {
						_this.test = '支付成功?'
						console.log('支付成功success:' , JSON.stringify(res));
						// return
						if (res.errMsg == 'requestPayment:ok') {
							_this.test='支付成功'
							uni.showToast({
								title: '支付成功',
								icon: 'none',
								success() {
									_this.payMoneyDispaly = false;
									
									uni.navigateTo({
										url:'../../pagesB/my-order/my-order'
									})
								}
							})	
						} 
					},
					fail: function(err) {
						_this.test = '调用支付失败' + JSON.stringify(err);
						console.log('调用支付失败' + JSON.stringify(err));
						return false;
					},
				});
			},
			
			//支付宝支付
			pay_alipay( response ){
				var _this = this;
				var ali = response.alipay;
				uni.requestPayment({
					provider: 'alipay',
					orderInfo:ali,
					success: function (res) {
						console.log('success:' + JSON.stringify(res));
						uni.showToast({
							title:'支付成功',
							icon:'none',
							success() {
								setTimeout(function(){
									_this.payMoneyDispaly = false;
									
									uni.navigateTo({
										url:'../../pagesB/my-order/my-order'
									});
								},1500)
							}
						});
					},
					fail: function (err) {
						console.log('fail:' + JSON.stringify(err));
					}
				});
			},
			 
			//调起预付款支付
			pay_money( response ){
				var _this = this;
				console.log('pay_money()', response);
				uni.showToast({
					title:'请输入支付密码',
					icon: 'none',
					success() {
						_this.order_id = response.shop_order_id;
					}
				});
			},
			
			paymentPasswordBack(e){
				console.log("支付密码点击了返回，进来了",e);
				this.pay_pass_display = false;
				this.payMoneyDispaly = false;
			}, 
			onConfirms(e) {
				var _this = this;
				let password = e.value;
				console.log('password', password, password.length);
				if( password.length != 6 ){
					fns.err('请正确输入密码');
				}else{
					
					if( _this.payMoneyDispaly ){
						return false;
					}
					
					_this.payMoneyDispaly = true; 
					
					pay.shoppingCar(_this.order_id,'user_money',password,function(){
					
							uni.showToast({
								title:'支付成功',
								success() {
									_this.pay_pass_display = false;
									setTimeout(function(){
										_this.payMoneyDispaly = false;
										uni.navigateTo({
											url:'../../pagesB/my-order/my-order'
										})
									},3000)
								}
							})
						
					})
				}
				// this.pay_pass_display=false
			},
			
			back() {
				uni.navigateBack({
					delta: 1
				});
			},
			showContadd:function(){
				this.jugLogin();
				this.xs=!this.xs;
				this.way=1; //加入购物车
			},
			showContgo:function(){
				//判断用户是否登录
				this.jugLogin();
				this.xs=!this.xs;
				this.way=2;  //立即购买
				this.goquans();
			},
			showCont:function(){
				this.xs=!this.xs;
			},
			toCar(){
				var _this=this
				let flag = _this.btnCLick;
				if (!flag) {
					return
				}
				_this.btnCLick = 0
				_this.btnCLickRest()
				
				if(_this.way==1){
					// _this.shoopingCar();
					uni.showLoading({
						title:'请稍等。。。',
						icon:'none'
						
					})
					if(_this.button_disabled==true){
						fns.err('请选择规格属性');
						_this.btnCLickRest()
						return;
					}else{
						// console.log(_this.inUserId,'---------1')
						ef.submit({
							request:{
								s:['SHOPCARTSELFADD',[{
									goods_sku_id:_this.sku_id,
									number:_this.number,
									recommend_user_id:_this.inUserId//推荐人id
									}]]
							},
							callback(data){
								if(fns.checkError(data,'s',function(errno,error){
									fns.err(error)
									_this.btnCLickRest()
								})){
									
									fns.success('已加入购物车',function(){
										uni.hideLoading()
										setTimeout(function(){
											uni.showToast({
												title:'已经加入购物车',
												icon:'none'
											})
											// uni.removeStorage({
											// 	key:"recommendInfo",
											// 	success:function(res){
											// 		console.log('success')
											// 	}
											// })
										})
										
									})
									_this.btnCLickRest()
								}
								_this.xs=false;
							}
						})
					}
				}
				if(_this.way==2){
					if (_this.button_disabled == true) {
						fns.err('请选择规格属性');
						return;
					} else {
						// console.log(_this.inUserId,'---------1')
						ef.submit({
							request: {
								s: [
									'SHOPCARTSELFADD',
									[
										{
											goods_sku_id: _this.sku_id,
											number: _this.number,
											recommend_user_id:_this.inUserId//推荐人id
										}
									]
								]
							},
							callback(data) {
								var dataList = fns.checkError(data, 's', function(errno, error) {
									uni.showToast({
										title: error,
										icon: 'none'
									});
								});
								_this.xs =false
								_this.isShow = false;
								console.log(dataList,'加入购物车')
								var cart_values=dataList.s
								
								var expressId = _this.expressId[_this.index] 
								console.log('expressIdexpressId',expressId)
								// uni.removeStorage({
								// 	key:"recommendInfo",
								// 	success:function(res){
								// 		console.log('success')
								// 	}
								// })
								
								uni.navigateTo({
									url:'../../pagesA/submitOrder/submitOrder?cart_values='+cart_values+'&address_id='+_this.address_id+'&expressId='+expressId
								})
								
								
							}
						});
					}
					
				}
			},
			shoopingCar(){
				var _this=this
				if(!_this.sku_id){
					fns.err('请选择规格属性');
					return;
				}else{
					ef.submit({
						request:{
							s:['SHOPCARTSELFADD',[{
								goods_sku_id:_this.sku_id,
								number:_this.number
								}]]
						},
						callback(data){
							if(fns.checkError(data,'s',function(errno,error){
								fns.err(error)
							})){
								fns.success('已加入购物车',function(){
									
								})
							}
						}
					})
				}
			},
			add:function(){
				if(this.number>0){
					this.number++;
				}else{
					return
				}
				
			},
			lose:function(){
				if(this.number>1){
					this.number--;
				}else{
					return
				}
			},
			collect(){
				var _this=this;
				if (_this.Collection) {
					//用户已收藏，取消收藏
					_this.collectionDel()
				} else{
					//用户未收藏
					_this.collection();
				}
					
			},
			goods_images_get(){
				var _this=this
				ef.submit({
					request:{
						s:['SHOPGOODSIMAGE',[{id:_this.id,sort:{orderby:'sort_asc'}}]],
					},
					callback(data){
						var list=fns.checkError(data,'s',function(errno,error){
							fns.err(error)
						})
						console.log('图片列表',list);
						_this.goods_image=list.s
					},error(err){
						fns.err('',err,1)
					}
				})
			},
			select(Class,id,index,indexs){
				var _this=this
				console.log('打印全部规格',_this.goods_spu)
				//如果点击的规格未选中
				if(Class=='stockTrue'){
					_this.button_disabled=false;  //是否选择规格属性
					console.log(Class,id,index,indexs);
					var _thisSon=_this.goods_spu[index].son;
					var id=_this.goods_spu[index].son[indexs].id
					for(var i=0;i<_thisSon.length;i++){
						//将未点击的规格属性取消选中   并且选中点击的规格属性
						if(_thisSon[i].class_change && i!=indexs){
							_thisSon[i].class_change='stockTrue'
							
						}else if(_thisSon[i].class_change && i==indexs){
							_thisSon[i].class_change='selecteds'
							
							//声明块级变量存储当前规格的索引和名称 2019.09.18 2019.09.18 wh
							let skuObj={index:index,name:_thisSon[i].name};
							if(_this.selectedSku.length==0)//无选中规格时直接加入
							{
								_this.selectedSku.push(skuObj)
							}
							else{
								_this.selectedSku.forEach(function(item,index){
									if(item.index==skuObj.index){
										item.name=skuObj.name;
									}
								})
							}
							
						}
					}
					//
					for(var m=0;m<_this.goods_spu.length;m++){
						if(m!=index){
							var _thisSon=_this.goods_spu[m].son;
						for(var i=0;i<_thisSon.length;i++){
							var _id=_thisSon[i].id
							if(_thisSon[i].class_change=='stockTrue'){
								_thisSon[i].class_change=''
							}
								for (var k=0; k<_this.goods_sku.length;k++) {
									var sku=_this.goods_sku[k].spu_id;
									if(sku.indexOf(_id) != -1 && sku.indexOf(id) != -1 && _thisSon[i].class_change!='selecteds'){//
										_thisSon[i].class_change='stockTrue';
									}
								}
						}
						}
					}
				}
				//如果点击的规格已选中
				else if(Class=='selecteds'){
					_this.button_disabled=true;  //是否选择规格属性
					console.log(Class,id,index,indexs);
					var _thisSon=_this.goods_spu[index].son;
					_thisSon[indexs].class_change='stockTrue'
					//移除选中规格数组中的项      2019.09.18 wh
					_this.selectedSku.forEach(function(item,index){
						if(item.index==index){
							_this.selectedSku.splice(index,1)
						}
					})
					
					
					//
					for(var m=0;m<_this.goods_spu.length;m++){
						if(m!=index){
							var _thisSon=_this.goods_spu[m].son;
						for(var i=0;i<_thisSon.length;i++){
							var _id=_thisSon[i].id
							if(_thisSon[i].class_change=='stockTrue'){
								_thisSon[i].class_change=''
							}
								for (var k=0; k<_this.goods_sku.length;k++) {
									var sku=_this.goods_sku[k].spu_id;
									if(sku.indexOf(_id) != -1 && _thisSon[i].class_change!='selecteds'){//
										_thisSon[i].class_change='stockTrue';
										
									}
								}
						}
						}
					}
				}
				console.log('选中的规格',_this.selectedSku)
				_this.moneyStock();
			},
			moneyStock(){
				var _this=this,ids=[];
				for(var m=0;m<_this.goods_spu.length;m++){
						var _thisSon=_this.goods_spu[m].son;
					for(var i=0;i<_thisSon.length;i++){
						if(_thisSon[i].class_change=='selecteds'){
							ids.push(_thisSon[i].id)
						}
					}
				}
				for (var k=0; k<_this.goods_sku.length;k++) {
					var sku=_this.goods_sku[k].spu_id;
					var key=false;
					for(var i=0;i<ids.length;i++){
						if(sku.indexOf(ids[i]) == -1){
							key=true;
							break;
						}
					}
					if(key==false){
						console.log('sku',_this.goods_sku[k]);
						_this.stock=_this.goods_sku[k].stock;
						_this.money_=_this.goods_sku[k].price;
						_this.sku_id=_this.goods_sku[k].id;
						break;
					}
				}
			},
			isTrue(){
				
			},
			collection(){
				var _this=this;
				ef.submit({
					request: {
						collect:['USERCOLLECTIONSELFADD',[{module:'shop_goods',key:_this.id}]]
					},
					callback: function(data){
						if(fns.checkError(data,'collect',function(errno,error){
							uni.showToast({
								title:error,
								icon:'none'
							})
						})){
							uni.showToast({
								title:'收藏成功',
								icon:'success',
								success() {
									_this.Collection=true
								}
							})
						}
					},
					error(err){
						fns.err('',err,1)
					}
				})	
			},
			collectionDel(){
				var _this=this;
				ef.submit({
					request: {
						collect:['USERCOLLECTIONSELFREMOVE',[{module:'shop_goods',key:_this.id}]]
					},
					callback: function(data){
						if(fns.checkError(data,'collect',function(errno,error){
							uni.showToast({
								title:error,
								icon:'none'
							})
						})){
							uni.showToast({
								title:'取消收藏',
								icon:'none',
								success() {
									_this.Collection=false
								}
							})
						}
					},
					error(err){
						fns.err('',err,1)
					}
				})	
			},
		    SeeMore(){
			uni.navigateTo({
				url:'../../pagesA/commentList/commentList?id='+this.id
			})
		   }
		}
	}
</script>
<style>
	.pl_item{
		height: 130px;float: left;box-shadow: 0px 0px 15px 0px rgba(232, 232, 232, 1)
	}
	.pl_userInfo{
		width: 140px;height: 100%;background-color: #fff;float:left;
	}
	.pl_headImg{
		width: 29px;height: 29px;border-radius: 50%;
	}
	.pl_nickname{
		width: 80px;padding-left: 10px;font-size: 28upx;
	}
	.pl_content{
		width: 90%;font-size: 12px;margin-left: 8px; font-size:26upx; color: #555555;word-wrap:break-word;
	}
	.pl_imgs{
		width: 130px;height: 100%;float:left;
	}
	
	image{
		width: 100%;height: 100%;
		float: left;
	}
	.line{
		width:750upx;
		height: 6upx;
		background-color: #f5f5f5;
	}
	.mask {  
		position: fixed;  
		top:0;  
		left:0;  
		z-index:4;  
		width:100%;  
		height:100vh;  
		background:rgba(0,0,0,0.4);  
	}  
</style>
<style scoped lang="stylus" ref="stylesheet/stylus">
	.content
		width 100%
		.mianImageBox
			width 100%
			height 100%
			background-color #fff
			display flex
			align-items center       // 垂直居中
			flex-direction column
			position relative
			.operateBox
				width 95%
				height 10%
				.titleIcon
					width 49%
				.right
					text-align right
					margin-right 5upx
			.casual
				width 100%
				// height 600upx
				.swiper-box
					width 100%
					// height 560upx
					// margin-left 8%
					// padding-top 40upx
					.swiper
					   width 100%
						height 100%
						display flex
						justify-content center
						align-items center
						.image
							 width 100%
							 height 100%
			
			.goodsInfor
			
				width 100%
				// height 1000upx
				display flex
				justify-content center
				align-items center
				flex-wrap wrap
				.price
					width 750upx
					height 124upx
					background-color #fff
					view
						width 656upx
						padding-left 32upx
						display flex
						justify-content space-between
					text
						font-size 40upx
						color red
						font-weight 600
						margin-right 24upx
					
					// text:nth-child(3)
					// 	display inline-block
					// 	padding 5upx 15upx
					// 	font-size 24upx
					// 	color #fff
					// 	background-color #e44545
					// 	margin-left 15upx
					.lineThrough
						font-size 26upx
						color #666
					.sold
						font-size 24upx
						float right
						margin-right 14upx
						color #666
				.selected
					height 60upx
					width 750upx
					.selected-view
						width 688upx
						height 60upx
						padding-left 32upx
						display flex
						justify-content space-between
						align-items center
						font-size 26upx
				.sendTo
					height 60upx
					width 750upx
					view
						width 688upx
						height 60upx
						padding-left 32upx
						display flex
						justify-content space-between
						align-items center
						font-size 26upx
				.evaluate
					// height 304upx
					width 750upx
					.evaluate-container
						width 688upx
						height 68upx
						padding-left 32upx
						display flex
						justify-content space-between
						align-items center
						font-size 28upx
						view
							display flex
							align-items center
					.evaluate-list-topline
						border-top 1upx solid #E4E4E4
					.evaluate-list
						width 688upx
						margin-left 32upx
						display flex
						align-items center
						padding-top 10upx
						.evaluate-list-headImage
							width 60upx
							height 60upx
						.evaluate-list-userName
							margin-left 10upx
							font-size 28upx
							text
								padding 0
							.evaluate-list-date
								font-size 24upx
								color #CCCCCC
								display block
					.evaluate-content
						width 688upx
						margin-left 32upx
						display flex
						align-items center
						.evaluate-contenttext
							width 688upx
							margin-left 70upx
							font-size 24upx
							padding-bottom 10upx
				.discountCard
					padding-left 20upx
					width 100%
					height 60upx
					background-color #f4f3f3
					text:nth-child(1)
						font-size 22upx
						color #fff
						background-color #333
						padding 5upx 10upx
					text:nth-child(2)
						font-size 22upx
						color #fff
						background-color #666
						padding 5upx 10upx
					text:nth-child(3)
						font-size 24upx
						color #333
						letter-spacing 3upx
						margin-left 20upx
						margin-right 240upx
					text:nth-child(4)
						display inline-block
						font-size 24upx
						line-height 60upx
						text-align center
						width 80upx
						height 60upx
						padding 0 12upx
						background-color #ccc
				.goodsdes
					width 750upx
					height 84upx
					padding-top 12upx
					.choose-kinds
						width 656upx
						height 68upx
						font-size 24upx
						text
							padding 10upx 20upx
							border-radius 20upx
							background-color #fff
						text:nth-child(1)
							border 1px solid #ccc
						.ex
							color #e44545
							margin-left 20upx
							border 1px solid #e44545
					.goods-name
						width 656upx
						height 110upx
						font-size 30upx
						background-color #fff
						line-height 45upx
						padding-left 32upx
						.self
							color #e44545
							font-size 24upx
							padding 3upx 12upx
							border 1px solid #e44545
							margin-right 20upx
						.details-des
							display block
							margin 10upx 0
							font-size 24upx
							color #7c7c7c
							letter-spacing 2upx
					.other-des
						width 100%
						height 80upx
						font-size 24upx
						color #333
						background-color #f4f3f3
						display flex
						justify-content left
						align-items center
						.origin, .method
							width 30%
							image
								width 40upx
								height 30upx
								margin -2upx 20upx
							.img
								background-color #fff
							text
								display inline-block
								line-height 80upx
								
				.deliverInfor
					width 100%
					height 130upx
					font-weight 600
					.to
						width 100%
						height 110upx
						line-height 110upx
						font-size 28upx
						border-top 1px solid #f4f3f3
						border-bottom 1px solid #f4f3f3
						position relative
						.first
							margin 0 22upx
						.to
							border none
							margin-right 15upx
						.icon
							font-size 32upx
							position absolute
							top 3upx
							right -2upx
					.freight
						width 100%
						height 110upx
						line-height 110upx
						font-size 28upx
						background-color #fff
						position relative
						.first
							margin 0 22upx
						.icon
							font-size 32upx
							position absolute
							top 3upx
							right -2upx
					.intro
						width 100%
						height 110upx
						line-height 110upx
						font-size 28upx
						border-top 1px solid #f4f3f3
						position relative
						.first
							margin 0 18upx
						.des
							display inline-block
							font-size 24upx
							font-weight 400
							height 60upx
							color #ccc
						.icon
							font-size 32upx
							position absolute
							top 3upx
							right -2upx
				.ask
					width 100%
					height 280upx
					.ask-title
						width 100%
						height 80upx
						display flex
						font-size 24upx
						align-items center
						position relative
						background-color #fff
						text:nth-child(1)
							font-weight 600
							width 100%
							text-align left
						.icon
							font-weight 600
							font-size 32upx
							position absolute
							top 24upx
							right -2upx
					.ask-item
						width 100%
						height 200upx
						.text
							width 100%
							display flex
							justify-content left   // 水平居中
							align-items center       // 垂直居中
							flex-direction row
							font-size 24upx
							margin-bottom 20upx
							background-color #fff
							.askS
								flex 0.5
								color #e44545
								padding 2upx
								border 1px solid #e44545
							.askW
								flex 13
								margin-left 15upx
							.reply
								flex 2						
				.brandStore
					width 100%
					height auto
					.brand-title
						width 100%
						display flex
						justify-content center   // 水平居中
						align-items center       // 垂直居中
						flex-direction row
						margin-bottom 30upx
						image
							flex 1.2
							height 100upx
						.good-items
							flex 6
							color #333
							margin-left 20upx
							font-size 24upx
							text
								width 100%
								display block
							
						.enter
							font-size 24upx
							letter-spacing 2upx
							color #e44545
							margin-right 10upx
					.goodgoods
						width 100%
						.recomend-goods-item2
							display inline-block
							width 22%
							height 240upx
							margin 20upx 10upx
							.img-box
								width 100%
								height 50%
								display flex
								justify-content center
								align-items center
								image
									width 150upx
									height 150upx
							.des
								display block
								font-size 28upx
								margin 30upx 0 5upx
								color #666
							.price
								font-size 32upx
								color red
					.guessGoodsBox
						width 100%
						height auto 
						margin-bottom 100upx
						background-color #fff
						.topBar
							width 100%
							height 80upx
							display flex
							justify-content left   // 水平居中
							align-items center       // 垂直居中
							flex-direction row
							text-align center
							font-size 24upx
							font-weight 600
							border-bottom 1px solid #f4f3f3
							.active
								flex 1
								.active
									height 100%
									padding-bottom 20upx
									border-bottom 3px solid #333
							.normal
								flex 1
						.goodsContentBox
							width 100%
							height 720upx
							margin-bottom 20upx
							display flex
							justify-content center   // 水平居中
							align-items center     // 垂直居中
							flex-direction column
							flex-wrap wrap
							.goods-item
								width 32%
								height 47%
								margin-bottom 10upx
								display flex
								justify-content center   // 水平居中
								align-items center 
								flex-direction column
								image
									width 150upx
									height 200upx
								.goods-name
									display block
									font-size 24upx
									width 200upx
								.now-price
									color #e44545
									margin 10upx 0
									font-size 24upx
						.button-box	
							width 100%
							height 60upx
							display flex
							justify-content center   // 水平居中
							align-items center       // 垂直居中
							flex-direction row
							text-align center
							text
								flex 1
								border 1px solid #333
								font-size 24upx
								padding 15upx
								letter-spacing 2upx
							.details
								color #fff
								background-color #333
						.imgDetails
							width 100%
							height 800upx
							.imgDetails-title
								width 100%
								height 66upx
								font-size 24upx
								letter-spacing 2upx
								display flex
								justify-content center   // 水平居中
								align-items center       // 垂直居中
								flex-direction row
								background-color #F5F5F5
							.productsBox
								.infor
									display block
									width 100%
									height 80upx
									color #333
									font-size 32upx
									font-weight 600
								.origin
									width 98%
									margin 0 auto
									border 1px solid #f4f3f3
									background-color #fff
									.infor-items
										width calc(100% - 20upx)
										text-align left
										
										padding-left 20upx
										font-size 24upx
										border-bottom 1px solid #f4f3f3
										text:nth-child(1)
											display inline-block
											width 20%
											padding 23upx 0 
											border-right 1px solid #f4f3f3
											
										text:nth-child(2)
											display inline-block
											width 65%
											font-wight 600
											padding 23upx 0 
											margin-left 20upx
							.getMore
								width 100%
								height 80upx
								line-height 80upx
								text-align center
								font-size 24upx
								margin-bottom 40upx
							.brandAuth
								width 120upx
								height 120upx
								margin 20upx auto
								border-radius 50%
								text-align center
								margin-top 60upx
								border 1px solid #ccc
								margin-bottom 200upx
								
								text
									display flex
									margin-top 17upx
									justify-content center
									align-items center
									line-height 30upx
									color #333
									font-size 32upx
											
			.shoppingCarBox	
				width 678upx
				padding 0 36upx
				height 100upx
				display flex
				justify-content center
				align-items center
				font-size 24upx
				position fixed
				bottom 0 
				left 0
				background #FFFFFF
				.collection
					height 100%
					width 50upx
					display flex
					justify-content center
					align-items center
					flex-direction column
					background-color #fff
					margin-right 60upx
					font-size 24upx
					color #F29B87
					image
						width 36upx
						height 36upx
				.shoppingCar
					height 100%
					
					width 50upx
					flex-direction column
					display flex
					justify-content center
					align-items center
					background-color #fff
					margin-right 40upx
					font-size 24upx
					color #F29B87
					image
						width 36upx
						height 36upx
				.add
					width 206upx
					height 70upx
					display flex
					color #F29B87
					font-size 30upx
					justify-content center
					align-items center
					background-color #FFFFFF
					border solid 1upx #F8C6B5
					border-radius 35upx
					margin-right 40upx
				.buy
					width 242upx
					height 70upx
					display flex
					font-size 30upx
					justify-content center
					align-items center
					color #fff
					background-color rgba(242,155,135,1)
					border-radius 35upx
		.mask_content
			width 100%
			height 600px
			background-color rgba(0, 0, 0 , 0.5)
			position fixed
			top 0
			left 0
			.mask-box
				position fixed
				bottom 0
				left 0
				font-size 26upx
				width 100%
				background-color #fff
				.mask-item
					width 100%
					height 220px
					display flex
					justify-content center
					align-items center
					flex-direction column
					text-align center
					background-color #fff
					.address, .deliver, .ticket, .invoice, .luckbag, .money, .agree
						flex 1
					.deliver, .ticket, .invoice, .luckbag, .money, .agree
						border-top 1px solid #ccc
					.address
						width 100%
						background-color #fff
						display flex
						justify-content center
						align-items center
						flex-direction row
						.address-item
							flex 4
							text-align left
							padding 10px
						.add
							flex 2
							color #E60B30
						.icon
							flex 1
							color #E60B30
							
					.deliver
						width 100%
						display flex
						justify-content center
						align-items center
						flex-direction row
						.address-item
							flex 4
							text-align left
							padding 10px
						.add
							flex 2
						.icon
							flex 1
					.ticket
						width 100%
						display flex
						justify-content center
						align-items center
						flex-direction row
						.address-item
							flex 4
							text-align left
							padding 10px
						.add
							flex 2
						.icon
							flex 1
					.invoice
						width 100%
						display flex
						justify-content center
						align-items center
						flex-direction row
						.address-item
							flex 4
							text-align left
							padding 10px
						.add
							flex 2
						.icon
							flex 1
					.luckbag
						width 100%
						display flex
						justify-content center
						align-items center
						flex-direction row
						.address-item
							flex 4
							text-align left
							padding 10px
						.add
							flex 2
						.icon
							flex 1
					.money
						width 100%
						display flex
						justify-content center
						align-items center
						flex-direction row
						.address-item
							flex 4
							text-align left
							padding 10px
						.add
							flex 2
							color #E60B30
						.tax
							color #ccc
							font-size 20upx
						.icon
							flex 1
					.agree
						width 100%
						display flex
						justify-content center
						align-items center	
						flex-direction row
						.address-item
							flex 4
							text-align left
							padding 10px
						.add
							flex 2
						.icon
							margin-left 5px
							width 24px
							height 24px
				.submit-btn
					width 100%
					height 60px
					background-color #E60B30
					text-align center
					line-height 60px
					color #fff
			.new-address-box
				position fixed
				bottom 0
				left 0
				font-size 26upx
				width 100%
				height 325px
				background-color #ccc
				.new-address-item_
					width 100%
					height 275px
					background-color #fff
					.address_
						width 95%
						height 50px
						margin 0 auto
						display flex
						justify-content center
						align-items center
						flex-direction row
						.address-item
							flex 1
							text-align left
						.icon
							flex 1
							text-align right
					.main-content
						width 100%
						height 220px
						display flex
						justify-content center
						align-items center
						flex-direction column
						text-align center
						border-top 1px solid #ccc
						.name-box
							flex 1
							width 100%
							height 100%
							display flex
							text-align left
							align-items center
							background-color #fff
							.name
								width 90%
								height 70%
								padding-left 10px
								background-color #f4f3f3
								margin 0 auto
							
						.phone-box
							flex 1
							width 100%
							height 100%
							display flex
							text-align left
							align-items center
							.phone
								width 90%
								height 70%
								padding-left 10px
								background-color #f4f3f3
								margin 0 auto
						.area-box
							flex 1
							width 100%
							height 100%
							display flex
							text-align left
							align-items center
							background-color #fff
							.area
								width 90%
								height 70%
								padding-left 10px
								background-color #f4f3f3
								margin 0 auto
						.details-box
							flex 1
							width 100%
							height 100%
							display flex
							text-align left
							align-items center
							.details
								width 90%
								height 70%
								padding-left 10px
								background-color #f4f3f3
								margin 0 auto
						.selected-box
							flex 1
							width 90%
							height 100%
							margin 0 auto
							display flex
							align-items center
							text-align left
							background-color #fff
							.empty-box
								flex 1
								height 69%
								display flex
								align-items center
								.empty
									width 20px
									height 20px
									border-radius 50%
									border 1px solid #333
							.selected-address
								flex 9
								height 70%
								display flex
								align-items center
				.submit-btn
					width 100%
					height 50px
					background-color #E60B30
					text-align center
					padding-top 15px
					color #fff
			.pay-methods
				position fixed
				bottom 0
				left 0
				font-size 26upx
				width 100%
				height 300px
				background-color pink
				.methods-box
					width 100%
					height 250px
					background-color #fff
					display flex
					justify-content center
					align-items center
					flex-direction column
					text-align center
					.title-box
						width 100%
						flex 0.9
						display flex
						align-items center
						justify-content center
						border-bottom 1px solid #ccc
						position relative
						.title
							width 100%
						image
							position absolute
							top 18px
							right 10px
							width 25px
							height 25px
					.pay-time-box
						width 100%
						flex 1
						display flex
						align-items center
						justify-content center
						border-bottom 1px solid #ccc
						.text
							flex 5.5
							text-align right
						.price
							flex 1.5
							color #E60B30
							text-align left
						.symbol
							flex 2
					.ali-pay
						width 100%
						flex 0.8
						display flex
						align-items center
						justify-content left
						padding-left 20px
						border-bottom 1px solid #ccc
						position relative
						image
							width 24px
							height 24px
						.select
							position absolute
							top 10px
							right 18px
					.weChat-pay
						width 100%
						flex 0.8
						display flex
						align-items center
						justify-content left
						padding-left 20px
						position relative
						image
							width 24px
							height 24px
						.select
							position absolute
							top 10px
							right 18px
					.active
						background-color #ccc
				.submit-btn
					width 100%
					height 50px
					background-color #E60B30
					text-align center
					padding-top 15px
					color #fff	
							
</style>
<style>
	/* .mask_content{
		width: 100%;
		height: 150upx;
		position: fixed;
		
	} */
	
	/* 上面部分均为支付 */
	.selecteds {
		color: #D23535 !important;
		background-color: #e6d2ca !important;
		border: 1upx #F8C6B5 solid;
	}
	/* .stockTrue {
		color: #333333 !important;
		font-weight: 600 !important;
	} */
	.shoppingx {
		width: 100%;
		height: auto;
		background-color: #ffffff;
		bottom: 0px;
		position: fixed;
		font-size: 30upx;
		z-index: 5;
	}
	.shoppingxx {
		width: 100%;
		padding-left: 5%;
	}
	.skubottom{
		margin-bottom: 10upx;
	}
	.text-title {
		width: 100%;
		height: 60upx;
		line-height: 60upx;
	}
	.shoppingx-span {
		width: 100%;
		position: relative;
		margin-top: 5upx;
	}
	
	.shopping-for text {
		margin-right: 10upx;
		position: relative;
		text-align: center;
		width: auto;
		/* height: 60upx; */
		/* line-height: 20upx; */
		background-color:#E6E6E6;
		padding-left: 28upx;
		padding-right: 28upx;
		padding-bottom: 5upx;
		padding-top: 5upx;
		font-size: 24upx;
		font-weight:normal;
		color: #686767;
		/* margin-top: 20upx; */
	}
	.quantity {
		float: left;
		width: 90%;
		height: 76upx;
		margin-top: 25upx;
		margin-bottom: 80upx;
		border-top:solid 2upx #F4F4F4;
		display: flex;
		justify-content: space-between;
		align-items: center;
		font-size:26upx ;
	}
	.quantity-right {
		display: flex;
		border: solid 2upx #F29B87;
		border-radius: 10upx;
	}
	.quantity-right view {
		width: 40upx;
		height: 40upx;
		display: flex;
		justify-content: center;
		align-items: center;
	}
	.quantity-right-left-gang{
		
		border-left: solid 2upx #F29B87;
	}
	.ascertain {
		position: absolute;
		bottom: 0px;
		width: 90%;
		height: 80upx;
		border-radius: 30upx;
		background-color: rgba(242,155,135,1);
		color: #FFFFFF;
		display: flex;
		justify-content: center;
		align-items: center;
		font-size: 42upx;
	}
	.close {
		width: 90%;
		height: 150upx;
		display: flex;
		align-items:center;
		justify-content:space-between;
		border-bottom:solid 2upx #F4F4F4;
	}
	.close-left{
		display: flex;
		
	}
	.close-left-goodname{
		width:200upx;
		margin-left: 20upx;
		display: flex;
		flex-direction:column;
		justify-content:flex-end;
	}
	.close-right{
		height: 100upx;
		width:100upx;
		display: flex;
		flex-direction:row-reverse;
	}
	.change1 {
		/* color: grey; */
		font-weight: 300;
		padding: 1 10px;
		border-radius: 10upx;
		color: #BEBEBE;
	}
	.change2 {
		color:#D4D4D4;
	}
	.messageBox {
		width: 96%;
		height: auto;
		margin-left: 2%;
		margin-right: 2%;
		font-size: 28upx;
	}
	.whengoods{
		width: 98%;
		height: 80upx;
		background-color: #da3b3b;
		color: #fff;
		line-height: 80upx;
		margin-bottom: 20upx;
		padding-left: 2%;
		font-size:30upx;
	}
	.imgNo_img{
		float:left;
	}
</style>


